package com.bea.ftd.dashboard.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;

@RestController
public class PrintMesageController {

    private Logger LOGGER = LoggerFactory.getLogger(PrintMesageController.class);

    @RequestMapping("/PrintMesage")
    private String PrintMesage(HttpServletRequest request){
        BufferedReader br = null;
        try {
            br = request.getReader();
            String str, wholeStr = "";
            while((str = br.readLine()) != null){
                wholeStr += str;
            }
            LOGGER.info(wholeStr);
            return "success";
        } catch (IOException e) {
            e.printStackTrace();
            return "fail";
        }

    }
}
